package com.getpebble.android.framework.endpoint;

import android.os.Bundle;
import android.os.Parcelable;
import com.getpebble.android.common.core.util.ObjectUtil;
import com.getpebble.android.framework.protocol.EndpointId;
import java.util.UUID;

public class EndpointRequest {
    private EndpointAction mAction;
    private Bundle mArguments;
    private EndpointId mEndpointId;

    public enum EndpointAction {
        GET_APP_BANK_INFO,
        SEND_PHONE_INCOMING_CALL_NOTIFICATION,
        SEND_PHONE_RING_NOTIFICATION,
        SEND_PHONE_START_NOTIFICATION,
        SEND_PHONE_END_NOTIFICATION,
        REMOVE_APP,
        ADD_APP,
        UPDATE_MUSIC_NOW_PLAYING,
        SEND_SET_TIME_MESSAGE,
        REQUEST_CORE_DUMP,
        SEND_DATALOGGING_ACK,
        SEND_DATALOGGING_NACK,
        SEND_DATALOGGING_REPORT_OPEN_SESSIONS,
        REQUEST_LOG_DUMP,
        PUSH_APP_MESSAGE,
        REQUEST_RUNNING_APP,
        START_APP,
        STOP_APP,
        CUSTOMIZE_APP,
        ADD_FILE,
        SEND_EXTENSIBLE_NOTIFICATION,
        REMOVE_EXTENSIBLE_NOTIFICATION
    }

    public enum EndpointArgumentKeys {
        UUID,
        URI,
        AUTO_START_APP,
        ALLOW_REINSTALL,
        VIBRATE,
        BANK_NUMBER,
        PHONE_NAME,
        PHONE_NUMBER,
        PHONE_COOKIE,
        DATALOGGING_SESSION,
        DATALOGGING_SESSIONS,
        APP_MESSAGE,
        APP_TITLE,
        BITMAP,
        APP_TYPE,
        FILE_NAME,
        ISO_LOCALE,
        LANGUAGE_VERSION
    }

    public EndpointRequest(EndpointId endpointId, EndpointAction action, Bundle arguments) {
        if (endpointId == null) {
            throw new IllegalArgumentException("'endpointId' cannot be null!");
        } else if (action == null) {
            throw new IllegalArgumentException("'action' cannot be null!");
        } else {
            this.mEndpointId = endpointId;
            this.mAction = action;
            if (arguments == null) {
                this.mArguments = new Bundle();
            } else {
                this.mArguments = arguments;
            }
        }
    }

    public EndpointRequest(EndpointId endpointId, EndpointAction action) {
        this(endpointId, action, null);
    }

    public EndpointId getEndpointId() {
        return this.mEndpointId;
    }

    public EndpointAction getAction() {
        return this.mAction;
    }

    private Bundle getArguments() {
        return this.mArguments;
    }

    public Integer getInt(EndpointArgumentKeys key) {
        return Integer.valueOf(this.mArguments.getInt(key.toString()));
    }

    public String getString(EndpointArgumentKeys key) {
        return this.mArguments.getString(key.toString());
    }

    public boolean getBoolean(EndpointArgumentKeys key) {
        return this.mArguments.getBoolean(key.toString(), false);
    }

    public UUID getUuid(EndpointArgumentKeys key) {
        String uuidStr = this.mArguments.getString(key.toString());
        if (uuidStr != null) {
            return UUID.fromString(uuidStr);
        }
        return null;
    }

    public Parcelable getParcelable(EndpointArgumentKeys key) {
        return this.mArguments.getParcelable(key.toString());
    }

    public byte[] getByteArray(EndpointArgumentKeys key) {
        return this.mArguments.getByteArray(key.toString());
    }

    public int[] getIntArray(EndpointArgumentKeys key) {
        return this.mArguments.getIntArray(key.toString());
    }

    public boolean equals(Object other) {
        boolean z = true;
        if (other == null) {
            return false;
        }
        if (other == this) {
            return true;
        }
        if (!(other instanceof EndpointRequest)) {
            return false;
        }
        EndpointRequest otherReq = (EndpointRequest) other;
        if (!(ObjectUtil.nullCheckEquals(getAction(), otherReq.getAction()) && ObjectUtil.nullCheckEquals(getEndpointId(), otherReq.getEndpointId()) && ObjectUtil.nullCheckEquals(getArguments(), otherReq.getArguments()))) {
            z = false;
        }
        return z;
    }

    public int hashCode() {
        int hash = 5;
        if (getAction() != null) {
            hash = getAction().hashCode() + 355;
        }
        if (getEndpointId() != null) {
            hash = (hash * 71) + getEndpointId().hashCode();
        }
        if (getArguments() != null) {
            return (hash * 71) + getArguments().hashCode();
        }
        return hash;
    }
}
